/*******************************************************************************
*  Project      : Minigate Golfin                                 
*  Program ID   : pop_idpw.js                                 
*  Description  : 아이디 비밀번호 찾기 팝업
*
********************************************************************************
*  Program History                                                            
*  Date        Author    Description                                          
*  ----------  --------  -------------------------------------------------------- 
*  2012-04-19  김효순    Created.  
*  2012-04-19  김효순    Finished.  
*******************************************************************************/

jQuery(function($){
	function clsControl()
	{
		this.openerControl = null;
		this.q_type = document.objUtil.getParam("q_type");
		
		this._init();
	}
	
	clsControl.prototype = {
		_init: function(){
			if(opener){
				if(opener.document.objControl){
					this.openerControl = opener.document.objControl;
				}
			}
			
			if(!this.openerControl) self.close();
			if(!this.q_type) self.close();
			
			var $obj = $("div.pw_area01:eq(0)");
			var res;
			switch(this.q_type){
				case "id":
					res = this.openerControl.getIdResult();
					if(res["결과코드"] != "00000") $("img[alt='로그인 하기']").hide();
					break;
				case "pw":
					res = this.openerControl.getPwResult();
					$("img[alt='로그인 하기']").hide();
					break;
			}
			$obj.find("p:first").html(res["메시지"]);
			
			this._bind();
			
			document.objUtil.setWindowSize()
		}
		, _bind: function(){
			var thisClass = this;
			
			// 로그인하기
			$("a").has("img[alt='로그인 하기']").click(function(event){
				event.preventDefault();
				
				thisClass.openerControl.goLogin(self);
			});
			
			//확인
			$("a").has("img[alt='확인']").click(function(){
				self.close();
			});
			
			// 닫기
			$("p.pop_close img").css("cursor", "pointer").click(function(){
				self.close();
			});
		}
	}
	
	document.objControl = new clsControl();
});